//###############
// FILE : ModComparator.java
// WRITER : Yaron Dinur, yarondi, 200184992
// WRITER : Yuval Ran, yuvran21, 032513483
// EXERCISE : oop ex1 2011
// DESCRIPTION:
// Compares two files by their last modification date.
//###############

package orders;

import java.io.File;
import java.util.Comparator;

/**
 * Compares two files by their last modification date.
 * @author yarondi
 *
 */
public class ModComparator extends AbsComparator {
	
	// Compares modification dates
	public int compare(File file1, File file2){
		Long l1 = new Long(file1.lastModified());
		Long l2 = new Long(file2.lastModified());
		int result = l1.compareTo(l2);
		if (result == 0)
			return super.compare(file1, file2);
		return result;
	}
	
}
